<template>
	<view class="container">
		<view class="header">

		</view>
		<view class="content">
			<view class="title">
				学习数据
			</view>
			<view class="box">
				<image src="https://q-api.guguzi.com/api/file/download/svjYZ5iUns_考试_1.png" mode="" class="icon">
				</image>
				<view class="text">
					预测考试通过率
				</view>
				<view class="num">
					{{info.rightRate||'--'}}
				</view>
			</view>
			<view class="cates">
				<view class="item" @tap="toQuestion(1)">
					<view class="value">
						{{info.notAnswer||'--'}}
					</view>
					<view class="label">
						未做题
					</view>
				</view>
				<view class="item" @tap="toQuestion(2)">
					<view class="value">
						{{info.errorAnswer||'--'}}
					</view>
					<view class="label">
						错题数
					</view>
				</view>
				<view class="item">
					<view class="value">
					{{info.rightRate||'--'}}
					</view>
					<view class="label">
						正确率
					</view>
				</view>
			</view>
			<view class="btn1" @tap="toQuestion(0)">
				继续练习
			</view>
			<!-- <view class="btn2">
				随机练习
			</view> -->
		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		reactive,
		unref,
		toRaw,
		toRefs,
		nextTick
	} from 'vue'
	import {
		onInit,
		onLoad,
		onReady,
		onShow,
		onHide,
		onUnload,
		onResize,
	} from '@dcloudio/uni-app'
	import {
		$http,
		toLogin,
		timestampToDateTime
	} from "@/common"
	const info=ref({})
	onShow((options) => {
		 setTimeout(()=>{
			 $http.get("questionStats",{type:1}).then(res=>{
			 			  console.log(res,'crjres')
			 			  info.value=res
			 })
		 },500)
        
    })
	function toQuestion(val){
		uni.navigateTo({                                                               
			url: '/pages/home/question?type='+val
		})                                        
	}                                                                                                                              
</script>                                                                                           
<style lang="scss" scoped>
	.container {
		height: 100%;
		background-color: #F9F9F9;

		.header {
			width: 100%;
			height: 300rpx;
			background: linear-gradient(to bottom, #1667EA, #F9F9F9);
		}

		.content {
			padding: 30rpx 20rpx;
			width: 700rpx;
			margin: -260rpx auto;
			background-color: #fff;
			border-radius: 20rpx;

			.title {
				font-size: 34rpx;
				font-weight: bold;
			}

			.box {
				margin: 30rpx 0 40rpx 0;
                background-color: #E7F1FD;
				display: flex;
				align-items: center;
				padding: 20rpx;
				border-radius: 20rpx;
				.text{
					margin: 0 10rpx;
				}
				.icon {
					width: 50rpx;
					height: 50rpx;
				}
				.num{
					color: #1667EA;
					font-size: 34rpx;
					font-weight: bold;
				}
			}

			.cates {
				padding: 0 20rpx;
				display: flex;
				justify-content: space-between;

				.item {
					text-align: center;
					.label {
						color: #696969;
					}

					.value {
						font-size: 34rpx;
						font-weight: bold;
						margin-bottom: 10rpx;
					}
				}
			}

			.btn1 {
				width: 100%;
				height: 76rpx;
				color: #fff;
				font-size: 32rpx;
				font-weight: bold;
				border-radius: 20rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				margin:50rpx 0 20rpx 0;
				background-color: #1667EA;
			}

			.btn2 {
				width: 100%;
				height: 76rpx;
				color: #1667EA;
				font-size: 32rpx;
				font-weight: bold;
				border-radius: 20rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				background-color: #EAF2FF;
			}
		}
	}
</style>